/**
 * Copyright (C) 2017 - 2020 https://github.com/joewee
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bifrost.model;

import com.alibaba.fastjson.JSON;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;

/**
 *外部订单模型
 *
 *@author joewee
 *@version 1.0.0
 *@Date 2018/4/22 22:24
 */
public class ExternalOrder {
    @Size(max=32, min=1)
    private String orderNumber;
    @NotBlank(message ="订单类型不能为空")
    private String type;
    @NotBlank(message ="会员卡号不能为空")
    private String cardNumber;
    /**
     * 原单号退货时需要
     */
    private String originNumber;
    @NotBlank(message ="门店不能为空")
    private String storeCode;
    @Past(message = "交易日期不正常")
    private Date businessDate;
    @NotNull
    private List<ExternalOrderItem> items;
    @NotNull
    private List<ExternalPayment> payments;

    private Integer totalBonusPoints=0;

    public enum Types{
        REFUND,
        SALES;
    }


    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public String getOriginNumber() {
        return originNumber;
    }

    public void setOriginNumber(String originNumber) {
        this.originNumber = originNumber;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getCardNumber() {
        return cardNumber;
    }

    public void setCardNumber(String cardNumber) {
        this.cardNumber = cardNumber;
    }

    public String getStoreCode() {
        return storeCode;
    }

    public void setStoreCode(String storeCode) {
        this.storeCode = storeCode;
    }

    public Date getBusinessDate() {
        return businessDate;
    }

    public void setBusinessDate(Date businessDate) {
        this.businessDate = businessDate;
    }

    public List<ExternalOrderItem> getItems() {
        return items;
    }

    public void setItems(List<ExternalOrderItem> items) {
        this.items = items;
    }

    public List<ExternalPayment> getPayments() {
        return payments;
    }

    public void setPayments(List<ExternalPayment> payments) {
        this.payments = payments;
    }

    public Integer getTotalBonusPoints() {
        return totalBonusPoints;
    }

    public void setTotalBonusPoints(Integer totalBonusPoints) {
        this.totalBonusPoints = totalBonusPoints;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }
}
